/*
 * Package: org.grassfield.common.dao
 * FileName: MenuDAO.java
 *  
 * Created by pandian on Jan 28, 2011
 */
package dao;

import java.util.List;

import bean.MenuItem;



/**
 * The Class MenuDAO.
 */
public class MenuDAO extends BaseDAO implements IMenuDAO {

	/* (non-Javadoc)
	 * @see org.grassfield.common.dao.IMenuDAO#list()
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<MenuItem> list() {
		return super.list("from MenuItem order by parentId, id");
	}

	@Override
	public MenuItem find(Long l) {
		List<Object> list = super.list("from MenuItem mi where mi.id=?", new Object[]{l});
		if (list.isEmpty())
			return null;
		return (MenuItem) list.get(0);
	}
}
